Skip to content

fix(streaks): use user timezone for date strings (#241)#251

Merged
phertyameen merged 3 commits intoMindBlockLabs:mainfrom
mijinummi:fix/241-timezone-date-strings
Feb 24, 2026
Merged

fix(streaks): use user timezone for date strings (#241)#251
phertyameen merged 3 commits intoMindBlockLabs:mainfrom
mijinummi:fix/241-timezone-date-strings

Conversation

@mijinummi
Copy link
Copy Markdown
Contributor

Fix UTC-based date strings causing incorrect streak/quest behavior (#241)

Problem

  • Date strings generated via toISOString() were UTC-only.
  • Users outside UTC experienced streak resets or quest mismatches near midnight.

Solution

  • Added getDateString(timeZone, offsetDays) utility in shared/utils.
  • Refactored streak and quest providers to use timezone-aware dates.
  • Controllers now accept X-User-Timezone header (default: UTC).
  • Added Jest unit tests for multiple timezones and midnight edge cases.

Acceptance Criteria

  • ✅ Dates reflect user’s local time.
  • ✅ Streak/quest continuity preserved across timezones.
  • ✅ Centralized date logic prevents duplication.
  • ✅ Backward compatibility maintained.

Testing

Copy link
Copy Markdown
Member

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The utils function solved the date issue. I just need to twick it to fit more into our current providers

@phertyameen phertyameen self-requested a review February 24, 2026 01:19
@phertyameen phertyameen merged commit 9890f20 into MindBlockLabs:main Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix UTC-based date strings causing incorrect streak/quest behavior for non-UTC users

2 participants